package com.bwie.controller;

import com.bwie.common.domain.GroupUser;
import com.bwie.common.domain.request.DishRequest;
import com.bwie.common.domain.request.GroupRequest;
import com.bwie.common.domain.request.GroupUserRequest;
import com.bwie.common.domain.request.MerchantRequest;
import com.bwie.common.result.Result;
import com.bwie.service.GroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @className: GroupController
 * @Description: TODO
 * @version: v1.８.0
 * @author: 张雨乐
 */
@CrossOrigin
@RestController
public class GroupController{
    @Autowired
    private GroupService groupService;

    /**
     * 商家列表
     * @param merchantRequest
     * @return
     */
    @PostMapping("merchantList")
    public Result merchantList(@RequestBody MerchantRequest merchantRequest){
        return groupService.merchantList(merchantRequest);
    }
    /**
     * 每个商家的团购套餐 需要传值商家的id
     * @param groupRequest
     * @return
     */
    @PostMapping("groupList")
    public Result groupList(@RequestBody GroupRequest groupRequest){
        return groupService.groupList(groupRequest);
    }
    /**
     * 团购套餐的菜品详细信息 需要传值套餐的id
     * @param groupId
     * @return
     */
    @GetMapping("dishList/{groupId}")
    public Result dishList(@PathVariable String groupId){
        return groupService.dishList(groupId);
    }
    /**
     * 查看团购记录
     * @param groupUserRequest
     * @return
     */
    @PostMapping("groupUser")
    public Result groupUser(@RequestBody GroupUserRequest groupUserRequest){
        return groupService.groupUser(groupUserRequest);
    }

    /**
     * 添加团购记录
     * @param groupUserRequest
     * @return
     */
    @PostMapping("groupUserAdd")
    public Result groupUserAdd(@RequestBody GroupUserRequest groupUserRequest){
        return groupService.groupUserAdd(groupUserRequest);
    }
    /**
     * 查看所有团购的商品价格
     * @param
     * @return
     */
    @PostMapping("getNum/{id}")
    public Result getNum(@PathVariable String id){
        return groupService.getNum(id);
    }


}
